﻿<UserControl x:Class="EtlViewer.Viewer.Controls.QueryDesigner" 
             x:ClassModifier="internal"             
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:ctrls="clr-namespace:EtlViewer.Viewer.Controls"     
             xmlns:utils="clr-namespace:EtlViewer.Viewer.UIUtils"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <Color x:Key="WizardGray">#FF2D2D30</Color>
        <Color x:Key="WizardGrayLight">#FF434343</Color>
        <SolidColorBrush x:Key="WizardGrayBrush" Color="{StaticResource WizardGrayLight}"></SolidColorBrush>
        <utils:NullToVisibilityConverter x:Key="NullToVisibilityConverter"></utils:NullToVisibilityConverter>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid Grid.Row="0">
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>

            <DockPanel Grid.Row="0"  LastChildFill="True" VerticalAlignment="Stretch"   Background="{StaticResource GrayBrush7}">
                <Border Margin="5,5,0,0"
                        Visibility="{Binding Visibility, ElementName=FileExplorer}">
                    <ctrls:ExplorerTree DockPanel.Dock="Top"                                
                                Grid.Column="0"                                  
                                Margin="0,0,0,0"
                                Width="250" 
                                x:Name="FileExplorer" 
                                BorderThickness="0" 
                                VerticalAlignment="Stretch"
                                >
                    </ctrls:ExplorerTree>
                </Border>
            </DockPanel>
            <Grid Grid.Column="1">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Grid Grid.Row="0" MinWidth="500" Background="{StaticResource GrayBrush7}"
                    HorizontalAlignment="Stretch" 
                    Visibility="{Binding Path=EditorModel.Template, Converter={StaticResource NullToVisibilityConverter}}">
                    <StackPanel >
                        <ctrls:Merlin 
                            x:Name="Wizard" 
                            HorizontalAlignment="Stretch"  
                            DataContext="{Binding EditorModel}" 
                            MinWidth="500"  />
                    </StackPanel>
                </Grid>
                <ctrls:CSharpTextBox 
                        x:Name="QueryEditor"
                        Margin="5,0,0,0"
                        Grid.Row="1"
                        Text="{Binding Text, Mode=TwoWay}" 
				        ScrollViewer.HorizontalScrollBarVisibility="Auto" 
                        ScrollViewer.VerticalScrollBarVisibility="Auto"
                        BorderThickness="0"
                        FontSize="10pt"
                        FontFamily="Consolas"
                    >
                </ctrls:CSharpTextBox>
            </Grid>
        </Grid>
    </Grid>
</UserControl>
